package com.xayy.mgt.enums;

import lombok.Getter;

/**
 * @author Nie
 * @version V1.0
 * @date 2023/9/20 17:24
 */
@Getter
public enum XzHealthStatus {

    A(100D, 80D, "A"),
    B(80D, 60D, "B"),
    C(60D, 40D, "C"),
    D(40D, 20D, "D"),
    E(20D, 0D, "E");



    XzHealthStatus(Double max, Double min, String level) {
        this.max = max;
        this.min = min;
        this.level = level;
    }

    private final Double max;
    private final Double min;

    private final String level;

    public static String valueOf(Double score) {
        for (XzHealthStatus value : values()) {
            if (score <= value.max && score > value.min)
                return value.level;
        }
        return "E";
    }


}
